import storage from './storage';


const ACCESS_TOKEN = '__access_token';


const get = (): string => {
    return <string>storage.get(ACCESS_TOKEN);
}
/**
 * @param value
 * @param duration
 */
const set = (value: string, duration?: number) => {
    const expiration = duration == undefined ? (new Date().getTime() + 300000) : duration * 1000;
    storage.set(ACCESS_TOKEN, value, expiration);
}

const remove = () => {
    storage.remove(ACCESS_TOKEN)
}


export default { get, set, remove }
